import { defineStore } from "pinia";
import router from "../../../apis/routers";
const key = getFilePathStore(import.meta.url);

export const useHomeSettingPageComponent = defineStore(key, {
    state: () => ({
        items:[
            {id:0,name:'manager-o',title:'账号与安全',click:(()=>{
                router.push({name:'agreement-safe'})
            })},
            {id:1,name:'cart-o',title:'我的订单',click:(()=>{
                router.push({name:'agreement-order'})
            })},
            {id:2,name:'question-o', title:'个人信息收集清单', click:(()=>{
                router.push({name:'agreement-gather'})
            })},
            {id:2,name:'coupon-o', title:'用户隐私协议', click:(()=>{
                router.push({name: 'agreement-privacy'});
            })},
            {id:2,name:'other-pay', title:'服务协议', click:(()=>{
                router.push({name: 'agreement-service'});
            })},
            {id:2,name:'service-o', title:'帮助与反馈', click:(()=>{
                router.push({name:'agreement-helper'});
            })},
            {id:2,name:'info-o', title:'关于', click:(()=>{
                router.push({name:'agreement-about'})
            })},
        ]
    }),
    actions: {
    },
    getters:{
        getFirstItem(state){
            return state.items[0];
        },
        getAnotherItems(state){
            const items = state.items.slice(1);
            return items;
        }
    },
    persist: {
        key: key,
        storage: sessionStorage
    }
})